package com.xianniu.ltc.enums;

import lombok.Getter;

/**
 * @author wangruijie
 * @version 1.0
 * @description: < 企业经营状态 >
 * @date 2021/5/27 19:32
 */
@Getter
public enum OperatingStateEnum {
    CX("019-017d6b29fd10000f","存续"),
    ZY("019-017d6b2ad7d90010", "在业"),
    DX("019-017d6b2af0800011", "吊销"),
    ZX("019-017d6b2b007f0012", "注销"),
    TY("019-017d6b2b5f2b0015", "停业"),
    QS("019-017d6b2b70600016", "清算");

    private String key;
    private String value;

    OperatingStateEnum(String key, String value){
        this.key=key;
        this.value=value;
    }
    /**
     * 自己定义一个静态方法,通过key返回枚举常量对象
     * @param key
     * @return
     */
    public static OperatingStateEnum getByKey(String key){

        for (OperatingStateEnum color: values()) {
            if(color.getKey().equals(key)){
                return  color;
            }
        }
        return null;
    }

    /**
     * 自己定义一个静态方法,通过value返回枚举常量对象
     * @param value
     * @return
     */
    public static OperatingStateEnum getByValue(String value){

        for (OperatingStateEnum color: values()) {
            if(color.getValue().equals(value)){
                return color;
            }
        }
        return null;
    }
}
